package com.ctgu.蓝桥杯真题.B组2018;

import java.io.*;
import java.math.BigInteger;

/**
 * @author: Backdiy
 * @data: 2021/4/12 15:21
 * @desc:
 */
public class C复数幂 {
    public static void main(String[] args) throws Exception {
        PrintWriter printWriter = new PrintWriter(new BufferedOutputStream(new FileOutputStream("C:\\Users\\20461\\Desktop\\out.txt")));
        BigInteger a = new BigInteger("2");
        BigInteger b = new BigInteger("3");
        BigInteger c = new BigInteger("2");
        BigInteger d = new BigInteger("3");
        for (int i = 2; i <= 123456; i++) {
            BigInteger subtract = a.multiply(c).subtract(b.multiply(d));
            BigInteger add = a.multiply(d).add(b.multiply(c));
            a=subtract;
            b=add;
        }
        printWriter.println(""+a+((b.compareTo(BigInteger.ZERO)>0)?"+":"")+b+"i");
    }

}
